/*

Author   : chaos

FileName : defualt_assign.cpp

Date     : 12/08/17 16:36:28

*/
#include <iostream>
#include <cstring>
using namespace std;

class String
{
    private:
        char * string;
        long len;

    public:
        String (const char*);
        void show_string();
};

void String::show_string()
{
    cout << "String :" << string << " string address : ";
    cout << (void*)string;

    cout << " length :" << len << endl;
}

String::String(const char * i_string)
{
    cout << "String << constructor called" << endl;
    len = strlen(i_string);
    string = new char [len + 1];
    strcpy(string,i_string);
}

int main(int argc ,char *argv[])
{

    String A_String(" The C++ Bible");
    String* B_String = new String ("C++ Explained");
    cout << " before String object assign" << endl;
    A_String = *B_String;

    cout << "A_String ..." << endl;
    A_String.show_string();

    cout << "B_String ..." << endl;
    B_String->show_string();
    return 0;
}
